<template>
	<div>
		<!--查询部分-->
		<el-row :gutter="24">
			<el-col :span="24" style="text-align: left;">
				<el-button type="primary" size="small" @click="query">查询</el-button>
				<el-button type="primary" size="small" @click="downloadDaily">导出</el-button>
			</el-col>
		</el-row>
		<el-row :gutter="24">
			<div id="" style="margin-left: 40%;margin-bottom: 20px; width: 65%;">
				<font face="宋体">
					<div style="border-collapse:collapse;font-size: 25px;margin:0 auto;color:#000000">
						润华汽车库存统计表
					</div>
				</font>
			</div>
			<div id="" style="float: left;width: 10%;margin-left: 3%;">
				{{momentFu(new Date())}}
			</div>
			<div id="" style="float: left;width: 20%;">
				单位(万元)
			</div>
		</el-row>
		<!--表格部分-->
		<el-table :data="receiveData" border="" stripe style="width:100%" v-loading.body="loading" height=600>
			<el-table-column prop="brandName" label="品牌名称" width="130" sortable></el-table-column>
			<el-table-column prop="companyName" label="公司" width="210"></el-table-column>
			<el-table-column label="整车库存统计" style="text-align: center;">
				<el-table-column prop="FinanceIn" label="预算平均库存" width="120"></el-table-column>
				<el-table-column prop="stockPrice" label="期末平均库存" width="120"></el-table-column>
				<el-table-column prop="lastPrice" label="上月库存余额" width="120"></el-table-column>
				<el-table-column prop="nowCount" label="期末库存数量" width="120"></el-table-column>
				<el-table-column prop="nowPrice" label="期末库存余额" width="120"></el-table-column>
				<el-table-column label="其中:超期库存" width="120">
					<el-table-column prop="overCount" label="数量" width="120"></el-table-column>
					<el-table-column prop="overPrice" label="金额" width="120"></el-table-column>
				</el-table-column>
				<el-table-column label="其中:整车六个月以上" width="120">
					<el-table-column prop="moreCount" label="数量" width="120"></el-table-column>
					<el-table-column prop="morePrice" label="金额" width="120"></el-table-column>
				</el-table-column>
				<el-table-column prop="lastYearPrice" label="去年同期库存余额" width="150"></el-table-column>
				<el-table-column prop="FinanceStock" label="核定周转天数" width="150"></el-table-column>
				<el-table-column prop="turnDay" label="本期库存周转天数" width="150"></el-table-column>
				<el-table-column prop="lastTurnDays" label="去年同期周转天数" width="150"></el-table-column>
				<el-table-column prop="nowYearCost" label="累积出库成本" width="150"></el-table-column>
			</el-table-column>
		</el-table>
		<!--分页-->
		<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" layout=" total" :total="total">
		</el-pagination>
	</div>
</template>
<script>
	import moment from 'moment'
	import company from '../../insPlugins/company.vue' //单位选择模块
	export default {
		data: function() {
			return {
				//每页的数量
				page: this.page,
				//页码数
				CurentPage: 1,
				//单位ID
				companyId: [],
				//单位名称
				companyLabel: "",
				//查询结果接收数据集
				receiveData: [],
				total: 0,
				loading: true,
			}
		},
		computed: {},
		methods: {
			//查询按钮
			query: function() {
				//等待动画
				this.$http.get(this.API_ROOT + '/scm/count/stockCountForms')
					.then((response) => {
						debugger;
						if(response.body.success) {
							this.$data.receiveData = response.body.dataList;
							this.$data.total = parseInt(response.body.total); //数据条数（必须强转成int类型，否则不显示）
							this.$data.loading=false;
							debugger;
						} else {}
						debugger;
					}, (response) => {});
				debugger;
			},
			//导出按钮
			downloadDaily: function() {
				window.location.href = this.API_ROOT + '/scm/count/excel/exportDay?uid=' + window.localStorage.getItem("uid") + "&dateStart=" + this.$data.data.dateStart + "&dateEnd=" + this.$data.data.dateEnd;
			},
			//时间格式化
			momentFu: function(dt) {
				if(dt == '' || dt == null || dt == undefined) {
					return "";
				} else {
					return this.moment(dt).format("YYYY-MM-DD");
				}
			},
		},
		//表单创建时执行
		created: function() {

			this.query();
		},
	}
</script>

<style>

</style>